<?php $this->view('common/include-header', array('header' => $header));?>

<div class="box-title"><i class="fa fa-home"></i>用户系统 <i class="fa fa-angle-double-right"></i>详细</div>
<form class="box-content" id="add-theme" method="post" action="<?=back_url()?>forum/update/<?=$info['id']?>" onsubmit="return false;">
    <div class="data-title normal"><i class="fa fa-database"></i>基本信息</div>
    <div class="data-content flyer-form">
        <div class="label checker">
            <span class="title-cue">标题 <i class="fa fa-angle-double-right"></i></span>
            <input class="huge" name="title" type="text" value="<?=$info['sThemeTitle']?>">
            <span class="warn-span"></span>
        </div>
        <div class="clear"></div>
        <div class="label">
            <span class="title-cue">分类 <i class="fa fa-angle-double-right"></i></span>
            <select name="category">
                <?php foreach($categorys[$category_id] as $category) {?>
                <option value="<?=$category['id']?>"<?php if($info['iCategoryId'] == $category['id']) { echo 'selected';}?>><?=$category['title']?></option>
                <?php if(isset($categorys[$category['id']])) {?>
                    <?php foreach($categorys[$category_id] as $category) {?>
                    <option value="<?=$category['id']?>"<?php if($info['iCategoryId'] == $category['id']) { echo 'selected';}?>>　　<?=$category['title']?></option>
                    <?php }?>
                <?php }?>
                <?php }?>
            </select>
        </div>
        <div class="clear"></div>
        <div class="label checker">
            <span class="title-cue">内容 <i class="fa fa-angle-double-right"></i></span>
            <textarea class="fl" id="content" name="content" width="400"><?=text_format($info['sContent'])?></textarea>
            <span class="warn-span"></span>
        </div>
        <div class="clear"></div>
    </div>
    <div class="data-title normal mt"><i class="fa fa-gear"></i>设置参数信息</div>
    <div class="data-content flyer-form">
        <div class="label fl">
            <span class="title-cue">标题颜色 <i class="fa fa-angle-double-right"></i></span>
            <input name="color" type="color" value="<?=$info['sTitleColor']?>">
        </div>
        <div class="clear"></div>
        <div class="label fl">
            <span class="title-cue fl">是否置顶 <i class="fa fa-angle-double-right"></i></span>
            <div class="radio-one fl mt-5px">
                <input class="edit" id="stick" name="stick" type="checkbox"<?php if($info['iStick'] == 1) { echo ' checked';}?> value="1">
                <label for="stick"></label>
            </div>
        </div>
        <div class="label fl">
            <span class="title-cue fl">是否精华 <i class="fa fa-angle-double-right"></i></span>
            <div class="radio-one fl mt-5px">
                <input class="edit" id="essence" name="essence" type="checkbox"<?php if($info['iEssence'] == 1) { echo ' checked';}?> value="1">
                <label for="essence"></label>
            </div>
        </div>
        <div class="label fl">
            <span class="title-cue fl">是否屏蔽 <i class="fa fa-angle-double-right"></i></span>
            <div class="radio-one fl mt-5px">
                <input class="edit" id="shield" name="shield" type="checkbox"<?php if($info['iIsShield'] == 1) { echo ' checked';}?> value="1">
                <label for="shield"></label>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="data-title normal mt"><i class="fa fa-gear"></i>帖子详细信息</div>
    <div class="data-content flyer-form">
        <div class="label">
            <span class="title-cue">回复数 <i class="fa fa-angle-double-right"></i></span>
            <span class="status red"><?= Render::number($info['iReplyCount']) ?></span>
        </div>
        <div class="label">
            <span class="title-cue">浏览量 <i class="fa fa-angle-double-right"></i></span>
            <span class="status red"><?= number_format($info['iViewCount']) ?></span>
        </div>
        <div class="clear"></div>
        <div class="label">
            <span class="title-cue">发帖人 <i class="fa fa-angle-double-right"></i></span>
            <span class="status red"><?= $user['sUserName'] ?></span>
        </div>
        <div class="label">
            <span class="title-cue">发帖时间 <i class="fa fa-angle-double-right"></i></span>
            <span class="status red"><?= $info['created_at'] ?></span>
        </div>
        <div class="label">
            <span class="title-cue">更新时间 <i class="fa fa-angle-double-right"></i></span>
            <span class="status red"><?= $info['updated_at'] ?></span>
        </div>
        <div class="clear"></div>
    </div>
    <div class="flyer-form">
        <div class="label">
            <span class="title-cue">&nbsp;</span>
            <input class="btn normal" type="button" id="save-button" value="保存">
            <input class="btn gray ml" type="button" id="back-list" value="返回" onclick="javascript:history.back(-1);">
            <textarea id="add-theme-json" data-form="#add-theme" style="display:none;"><?=$relate?></textarea>
        </div>
    </div>
</form>

<?php $this->view('common/include-editor');?>
<script src="<?=static_url()?>js/form-check.js"></script>
<script>
    $(document).ready(function () {
        var ueditor = editor('content', {height: 300, width: 900});
        
        // 表单数据验证
        (new checker).init({ ruleJson: '#add-theme-json', submit: '#save-button' });
        // 表单提交验证
        $('#save-button').bind('click', function () {
            if(check_submit('#add-theme-json')) {
                $('#save-button').attr('disabled', true).val('保存中...');
                $.get($('#add-theme').attr('action') + '?submit_type=json&type=full', $('#add-theme').serialize(), function(ret_data) {
                    var data = $.parseJSON(ret_data);
                    if (data.code == 200) {
                        if ( ! (/\d{1,}$/.test($('#add-theme').attr('action')))) {
                            $('#add-theme').attr('action', $('#add-theme').attr('action') + data.param.id);
                        }
                        layer.alert('保存成功~', {icon: 1});
                    }
                    else {
                        layer.msg(data.message, {shift: 6});
                    }
                    $('#save-button').attr('disabled', false).val('保存');
                });
            }
        });
    });
</script>

<?php $this->view('common/include-footer');?>